package org.darkforest.task;

import org.darkforest.common.services.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * Created by Libing on 2015/7/8.
 */
@Component
public class OrderQuartz{

    @Autowired
    private OrderService orderService;

    /**
     * 定时任务 将超时未支付的订单设置为订单取消状态
     */
    @Scheduled(cron = "0 0/10 * * * ?")
    public void CancleUnpayOrder(){
        orderService.cancleUnpayOrder();
    }

    /**
     * 定时任务 超过10天的订单设置自动收货 并且自动评价
     */
    @Scheduled(cron = "0 0/10 * * * ?")
    public void AutoReceiveAndEvaluate(){
        orderService.AutoReceiveAndEvaluate();
    }

//    /****会员升级
//     * 会员消费额统计，会员等级
//     */
//    @Scheduled(cron = "0 0 23 * * ?")
//    public void orderBalance(){
//        orderService.orderBalance();
//    }

    /**
     * 商家佣金计算报表 每个月1号的 1点 执行 :cron = "0 0 1 1 * ?"
     */
    @Scheduled(cron = "0 0 1 1 * ?")
    public void orderCommission(){
        orderService.orderCommissionStatistics();
    }
}
